﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Data.Model;
using NHibernate;
using DotNet.Common.NHibernateUtil;

namespace ZLCMS.Web.SystemManage.weixin.Material
{
    public partial class SetMaterialControl : System.Web.UI.UserControl
    {
        public int MaterialId { get; set; }

        protected WxMaterial Material { get; set; }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (IsPostBack)
            {
                try
                {
                    MaterialId = Int32.Parse(Request["mat.id"]);
                }
                catch 
                {
                	
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (MaterialId > 0)
            {
                using (ISession session = SessionFactoryHelper.CreateSession())
                {
                    Material = session.Get<WxMaterial>(MaterialId);
                }
            }
            if (Material == null)
            {
                Material = new WxMaterial();
            }
        }
    }
}